﻿<!--本页面由uniapp切片工具生成，uni-app切片-可视化设计工具(一套代码编译到7个平台iOS、Android、H5、小程序)，软件下载地址：http://www.ymznkf.com/new_view_669.htm -->
<template>
	<view class="YmContent">
			<view class="commodity_details_1" style="height: 2600rpx;">
				<!-- <image v-on:click="commodity_details_2_2_click()"  src="/static/commodity_details/images/commodity_details_2_2.jpg" mode="scaleToFill" border="0"    class="commodity_details_2"></image> -->
				<h2 style="font-size: 34px; text-align: center;">{{task.name}}</h2>
				<view class="commodity_details_3">
					<!-- <image v-on:click="commodity_details_13_13_click()"  src="/static/commodity_details/images/commodity_details_13_13.jpg" mode="scaleToFill" border="0"    class="commodity_details_13"></image> -->
					
					<text decode="true" class="commodity_details_15">总金额</text>
					<text decode="true" class="commodity_details_14">{{task.price}} RMB</text>
					<text decode="true" style="font-size: 16px;   color: darkred;float: right"  >状态：{{task.status}}</text>
					
				</view>
				<view class="commodity_details_4">
				</view>
				<text decode="true" class="commodity_details_5">项目详情</text>
				<text decode="true" class="commodity_details_6" style="max-height: 600px; overflow: hidden;">{{task.task_desc}}</text>
				<text decode="true" class="commodity_details_5" >项目里程碑</text>
				<text decode="true" class="commodity_details_6" style="height: 500rpx;">{{lcb}}</text>
				<text decode="true" class="commodity_details_7" style="width: 200rpx;">奖励详细说明</text>
				<text decode="true" class="commodity_details_8">该项目奖励为：{{task.reward_type}}\n 详细：{{task.reward_desc}}</text>
				<text decode="true" class="commodity_details_5" style="width: 300rpx;">项目创建者详情</text>
				<text decode="true" class="commodity_details_6" style="max-height: 600px; overflow: hidden;">{{user}}</text>
				
				<text decode="true" class="commodity_details_9"  v-if="task.status=='正在进行'" >点击投资即代表您已阅读并同意《投资协议》</text>
				<view @tap="touzi()" class="commodity_details_10" v-if="task.status=='正在进行'" >
					
					<image src="/static/commodity_details/images/commodity_details_11_11.jpg" mode="scaleToFill" border="0"    class="commodity_details_11"></image>
					<text  decode="true" class="commodity_details_12" >点击投资</text>
				</view>
				<view style="background-color: gainsboro;" class="commodity_details_10" v-if="task.status!='正在进行'" >
					
					<!-- <image src="/static/commodity_details/images/commodity_details_11_11.jpg" mode="scaleToFill" border="0"    class="commodity_details_11"></image> -->
					<text  decode="true" class="commodity_details_12  " style="width: 300px; text-align: center;" >该状态暂不能投资</text>
				</view>
			</view>
		

		<view class="loading">{{loadingText}}</view>
		<view class="ymBbottom"></view>
		<uni-popup ref="popup" type="center">
			<view class="bg-fff bor-rad10r w566r">
				<view class="p36r bor-b fw-w l-h1">投诉该项目</view>
				<view class="p36r ">
					<view class="" style="text-align: center;">
						<input placeholder="请输入投诉内容" v-model="tousu"></input></br>
						<!-- <text class="color-or" >请提前准备相关资料！</text> -->
						<!-- <text class="">以上，并且锁定期{{activation_day}}天，{{activation_day}}天后可提现。</text> -->
					</view>
					<view class="bg-zs color-fff x-c h68r bor-rad10r mt30r" @tap="submit()">投诉</view>
				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
export default {
		data() {
			return {
				loadingText: '',
				task: {},
				tousu: '',
				lcb: '',
				user: '',
				page:0,//当前分页页码
				apiUrl:'https://www.ymznkf.com/wx_server',//后端接口地址
				id:'',//传值使用,方便存在本地的locakStorage  
				del_id:''//方便存在本地的locakStorage  
			}
		},
		components:{

		},
		onNavigationBarButtonTap(e) {

			if(e.text =='投诉'){
				this.$refs.popup.open()
			}
			if(e.text =='交流'){
				uni.navigateTo({
					url: '/pages/index/card/uni-comment?task_id='+ this.task.task_id
				})
			}
		},
		onLoad(options) {
			console.log(options)
			var that = this
			this.$api.get_task_detail({task_id:options.task_id}).then(res => {
				console.log(res)
				if(res.code ==  10000){
					that.task = res.data.task
					var u = res.data.user
					for (var i=0;i<that.task.inputItems.length;i++)
						that.lcb = that.lcb+ '里程碑' + (i+1).toString() +'： 目标：'+that.task.inputItems[i].text+ '。 金额：'+that.task.inputItems[i].price+'\n'
					}
					
					try {
						that.user = `姓名: ${u.valid_infos.name}  职业：${u.valid_infos.career}\n学位：${u.valid_infos.degree} 院校：${u.valid_infos.school}\n 手机：${u.valid_infos.mobile} 邮箱：${u.valid_infos.email}\n 区域：${u.valid_infos.area} 联系地址：${u.valid_infos.address}\n 个人介绍：${u.valid_infos.info} \n `
					} catch (error) {
					    that.user =''
					}
				});

			this.page=0;

			//检测有没有传入id参数
			if (options.id != null && options.id !=""){
				this.id=options.id;
			}   
			//执行初始化,需要用的时候，可以把注释取掉
			//this.Refresh("init");

		},
		onShow() {
			console.log("on show");
		},
		methods: {
			
			submit(){
				if(this.tousu.length<5){
					uni.showToast({
						title: '请输入超过5个字',
						icon: 'none',
						duration: 2000
					})
					return
				}
				this.$refs.popup.close();
				var user = uni.getStorageSync('loginInfo')
				var data = {
					task_id : this.task.task_id,
					task_name : this.task.name,
					tousu : this.tousu,
					user: {username: user.username, user_id: user.user_id}
				}
				var that = this
				this.$api.add_task_tousu(data).then(res => {
					console.log(res)
					if(res.code ==  10000){
						that.tousu = ''
						uni.showToast({
							duration:2000,
							title:'已收到您的投诉，谢谢',
							icon: 'none'
						})
						}
						
					});
			},
			touzi(){
				console.log(1)
				uni.navigateTo({
					url: '/pages/task/commodity_details/touzi?task_id='+ this.task.task_id
				})
			}
		}
	}

</script>

<style lang="scss" scoped>
   @import './commodity_details.scss'
</style>